Const LT_POINT:Int			= 0
Const LT_DIRECTIONAL:Int	= 1
Const LT_SPOTLIGHT:Int		= 2

Type Light Extends BaseObject
rem
bbdoc: Sets the type of light - see LightTypes for more info. 
endrem
	Method setType(lightType:Int = LT_POINT)
		o_light_setType(Self._ptr, lightType)
	End Method
	
rem
bbdoc: Sets the position of the light. 
about: Applicable to point lights and spotlights only. Parameters 
will be overridden if the light is attached to a SceneNode. 
endrem
	Method SetPosition(x:Float, y:Float, z:Float)
		o_light_setPosition(Self._ptr, x, y, z)
	End Method
	
rem
bbdoc: Sets the colour of the diffuse light given off by this source. 
about: <p>Material  objects have ambient, diffuse and specular values which indicate how 
much of each type of light an object reflects. This value denotes the amount and colour of 
this type of light the light exudes into the scene. The actual appearance of objects is a 
combination of the two.</p>
<p>Diffuse light simulates the typical light emanating from light sources and affects the 
base colour of objects together with ambient light.</p>
endrem
	Method setDiffuseColour(r:Float, g:Float, b:Float)
		o_light_setDiffuseColour(Self._ptr, r, g, b)
	End Method
	
rem
bbdoc: Sets the colour of the specular light given off by this source. 
about: <p>Material  objects have ambient, diffuse and specular values which indicate how 
much of each type of light an object reflects. This value denotes the amount and colour of 
this type of light the light exudes into the scene. The actual appearance of objects is a 
combination of the two.</p>
<p>Specular light affects the appearance of shiny highlights on objects, and is also 
dependent on the 'shininess' Material value.</p>
endrem
	Method setSpecularColour(r:Float, g:Float, b:Float)
		o_light_setSpecularColour(Self._ptr, r, g, b)
	End Method
	
rem
bbdoc: Returns the colour of the diffuse light given off by this light source (see setDiffuseColour for more info).
endrem
	Method getDiffuseColour:ColourValue()
		Local cv:ColourValue = New ColourValue
		cv.fromC(o_light_getDiffuseColour(Self._ptr))
		Return cv
	End Method
	
rem
bbdoc: Returns the colour of specular light given off by this light source. 
endrem
	Method getSpecularColour:ColourValue()
		Local cv:ColourValue = New ColourValue
		cv.fromC(o_light_getSpecularColour(Self._ptr))
		Return cv
	End Method
	
rem
bbdoc: Sets the attenuation parameters of the light source i.e. how it diminishes with distance.
about: <p>Lights normally get fainter the further they are away. Also, each light is given a 
maximum range beyond which it cannot affect any objects.</p>
<p>Light attenuation is not applicable to directional lights since they have an infinite range 
and constant intensity.</p>
<p>This follows a standard attenuation approach - see any good 3D text for the details of what 
they mean since i don't have room here!</p>
<p><b>Parameters:</b></p>
<table cellpadding="4" cellspacing="4" border="0">
<tr>
	<td>
		<i>range</i>
	</td>
	<td>
		The absolute upper range of the light in world units
	</td>
</tr>
<tr>
	<td>
		<i>constant</i>
	</td>
	<td>
		The constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation
	</td>
</tr>
<tr>
	<td>
		<i>linear</i>
	</td>
	<td>
		The linear factor in the attenuation formula: 1 means attenuate evenly over the distance
	</td>
</tr>
<tr>
	<td>
		<i>quadratic</i>
	</td>
	<td>
		The quadratic factor in the attenuation formula: adds a curvature to the attenuation formula. 
	</td>
</tr>
</table>
endrem
	Method setAttenuation(rng:Float, constant:Float, linear:Float, quadratic:Float)
		o_light_setAttenuation(Self._ptr, rng, constant, linear, quadratic)
	End Method
	
rem
bbdoc: Returns the absolute upper range of the light. 
endrem
	Method getAttenuationRange:Float()
		Return o_light_getAttenuationRange(Self._ptr)
	End Method
	
rem
bbdoc: Returns the quadric factor in the attenuation formula. 
endrem
	Method getAttenuationQuadric:Float()
		Return o_light_getAttenuationQuadric(Self._ptr)
	End Method
	
rem
bbdoc: Returns the linear factor in the attenuation formula. 
endrem
	Method getAttenuationLinear:Float()
		Return o_light_getAttenuationLinear(Self._ptr)
	End Method
	
rem
bbdoc: Returns the constant factor in the attenuation formula. 
endrem
	Method getAttenuationConstant:Float()
		Return o_light_getAttenuationConstant(Self._ptr)
	End Method
	
rem
bbdoc: Returns the position of the light. 
about: Applicable to point lights and spotlights only. 
endrem
	Method GetPosition:bVector3()
		Local vec3:bVector3 = bVector3.NullVec()
		vec3.fromC(o_light_getPosition(Self._ptr))
		
		Return vec3
	End Method
	
rem
bbdoc: Sets the direction in which a light points. 
about: Applicable only to the spotlight and directional light types.
endrem	
	Method setDirection(x:Float, y:Float, z:Float)
		o_light_setDirection(Self._ptr, x, y, z)
	End Method
	
rem
bbdoc: Returns the light's direction. 
about: Applicable only to the spotlight and directional light types.
endrem
	Method getDirection:bVector3()
		Local vec3:bVector3 = bVector3.NullVec()
		vec3.fromC(o_light_getDirection(Self._ptr))
		
		Return vec3
	End Method
	
rem
bbdoc: Sets the range of a spotlight, i.e. the angle of the inner and outer cones and the rate of falloff between them. 
about: <p><b>Parameters:</b></p>
<table cellpadding="4" cellspacing="4" border="0">
<tr>
	<td>
		<i>innerAngle</i>
	</td>
	<td>
		Angle covered by the bright inner cone The inner cone applicable only to Direct3D, it'll always treat as zero in OpenGL.
	</td>
</tr>
<tr>
	<td>
		<i>outerAngle</i>
	</td>
	<td>
		Angle covered by the outer cone
	</td>
</tr>
<tr>
	<td>
		<i>falloff</i>
	</td>
	<td>
		The rate of falloff between the inner and outer cones. 1.0 means a linear falloff, less means slower falloff, higher means faster falloff. 
	</td>
</tr>
</table>
endrem
	Method setSpotlightRange(innerAngle:Float, outerAngle:Float, falloff:Float = 1.0)
		o_setSpotlightRange(Self._ptr, innerAngle, outerAngle, falloff)
	End Method
	
rem
bbdoc: Sets the angle covered by the spotlights inner cone.
endrem
	Method setSpotlightInnerAngle(angle:Float)
		o_setSpotlightInnerAngle(Self._ptr, angle)
	End Method
	
rem
bbdoc: Sets the angle covered by the spotlights outer cone. 
endrem
	Method setSpotlightOuterAngle(angle:Float)
		o_setSpotlightOuterAngle(Self._ptr, angle)
	End Method
	
rem
bbdoc: Sets the angle covered by the spotlights outer cone. 
endrem
	Method setSpotlightFalloff(falloff:Float)
		o_setSpotlightFalloff(Self._ptr, falloff)
	End Method
	
rem
bbdoc: Returns the angle covered by the spotlights inner cone. 
endrem	
	Method getSpotlightInnerAngle:Float()
		Return o_getSpotlightInnerAngle(Self._ptr)
	End Method
	
rem
bbdoc: Returns the angle covered by the spotlights outer cone. 
endrem	
	Method getSpotlightOuterAngle:Float()
		Return o_getSpotlightOuterAngle(Self._ptr)
	End Method	
	
rem
bbdoc: Returns the falloff between the inner and outer cones of the spotlight. 
endrem	
	Method getSpotlightFalloff:Float()
		Return o_getSpotlightFalloff(Self._ptr)
	End Method	
	
rem
bbdoc: Set a scaling factor to indicate the relative power of a light.
about: This factor is only useful in High Dynamic Range (HDR) rendering. You can bind it to a shader variable to take it into account
endrem
	Method setPowerScale(power:Float = 1.0)
		o_light_setPowerScale(Self._ptr, power)
	End Method
	
rem
bbdoc: Returns the scaling factor which indicates the relative power of a light. 
endrem
	Method getPowerScale:Float()
		Return o_light_getPowerScale(Self._ptr)
	End Method
	
	Method getMovableType:String()
		Local typ:String
		Return typ.FromCString(o_light_getMovableType(Self._ptr))
	End Method
	
rem
bbdoc: Although lights themselves are not 'visible', setting a light to invisible means it no longer affects the scene. 
endrem
	Method setVisible(visible:Byte)
		o_light_setVisible(Self._ptr, visible)
	End Method
	
rem
bbdoc: Sets the maximum distance away from the camera that shadows by this light will be visible. 
about: <p>Shadow techniques can be expensive, therefore it is a good idea to limit them to being rendered close to the camera 
if possible, and to skip the expense of rendering shadows for distance objects. This method allows you to set the distance 
at which shadows will no longer be rendered.</p>
<p><b>Note:</b> Each shadow technique can interpret this subtely differently. For example, one technique may use this to 
eliminate casters, another might use it to attenuate the shadows themselves. You should tweak this value to suit your chosen 
shadow technique and scene setup. 
endrem
	Method setShadowFarDistance(distance:Float)
		o_light_setShadowFarDistance(Self._ptr, distance)
	End Method
	
rem
bbdoc: Set the far clip plane distance to be used by the shadow camera, if this light casts texture shadows. 
about: This is different from the 'shadow far distance', which is always measured from the main camera. This distance is the 
far clip plane of the light camera. 
<p><b>Parameters:</b></p>
<table cellpadding="4" cellspacing="4" boder="0">
<tr>
	<td><i>farClip</i></td>
	<td>The distance, or -1 to use the main camera setting</td>
</tr>
</table>
endrem
	Method setShadowFarClipDistance(farClip:Float)
		o_light_setShadowFarClipDistance(Self._ptr, farClip)
	End Method

rem
bbdoc: Tells the light to use the shadow far distance of the SceneManager. 
endrem
	Method resetShadowFarDistance()
		o_light_resetShadowFarDistance(Self._ptr)
	End Method
	
rem
bbdoc: Gets the maximum distance away from the camera that shadows by this light will be visible. 
endrem
	Method getShadowFarDistance:Float()
		Return o_light_getShadowFarDistance(Self._ptr)
	End Method
	
rem
bbdoc: Set the near clip plane distance to be used by the shadow camera, if this light casts texture shadows. 
about: <p><b>Parameters:</b></p>
<table cellpadding="4" cellspacing="4" boder="0">
<tr>
	<td><i>nearClip</i></td>
	<td>The distance, or -1 to use the main camera setting </td>
</tr>
</table>
endrem
	Method setShadowNearClipDistance(nearClip:Float)
		o_light_setShadowNearClipDistance(Self._ptr, nearClip)
	End Method
	
rem
bbdoc: Get the near clip plane distance to be used by the shadow camera, if this light casts texture shadows. 
about: May be zero if the light doesn't have it's own near distance set; use _deriveShadowNearDistance for a version guaranteed to give a result. 
endrem
	Method getShadowNearClipDistance:Float()
		Return o_light_getShadowNearClipDistance(Self._ptr)
	End Method
	
rem
bbdoc: Get the far clip plane distance to be used by the shadow camera, if this light casts texture shadows. 
about: May be zero if the light doesn't have it's own far distance set; use _deriveShadowfarDistance for a version guaranteed to give a result. 
endrem
	Method getShadowFarClipDistance:Float()
		Return o_light_getShadowFarClipDistance(Self._ptr)
	End Method

Rem
	bbdoc:Returns the name of this object.
End Rem
	method getName:String()
		Local n:String
		Return n.FromCString(o_light_getName(Self._ptr))
	End Method

rem
bbdoc: Returns the node to which this object is attached. 
endrem
	Method getParentNode:SceneNode()
		Local node:SceneNode = New SceneNode
		node._ptr = o_light_getParentNode(Self._ptr)
		
		Return node
	End Method
	
rem
bbdoc: Returns the scene node to which this object is attached.  
endrem
	Method getParentSceneNode:SceneNode()
		Local node:SceneNode = New SceneNode
		node._ptr = o_light_getParentSceneNode(Self._ptr)
		
		Return node
	End Method
	
rem
bbdoc: Sets whether or not this object will cast shadows. 
about: <p>This setting simply allows you to turn on/off shadows for a given object. An object will not cast shadows unless the 
scene supports it in any case (see SceneManager::setShadowTechnique), and also the material which is in use must also have shadow 
casting enabled. By default all entities cast shadows. If, however, for some reason you wish to disable this for a single object 
then you can do so using this method.</p>
<p><b>Note:</b> This method normally refers to objects which block the light, but since Light is also a subclass of MovableObject, 
in that context it means whether the light causes shadows itself.</p>
endrem
	Method setCastShadows(enable:Byte)
		o_light_setCastShadows(self._ptr, enable)
	End Method
End Type